//排课数据统计分析


import React, { useEffect, useState } from 'react';
import { Layout, Row, Col, Card, Statistic, Table, Tag } from 'antd';
import { getScheduleAPI } from '@/api/admin';

const { Header, Content } = Layout;

// const data = [
//   {
//     // key: '1',
//     course: '科目一',
//     date: '2024-05-15',
//     time: '09:00 - 12:00',
//     instructor: '张教练',
//     location: '教室101',
//   },
//   {
//     // key: '2',
//     course: '科目二',
//     date: '2024-05-16',
//     time: '13:00 - 15:00',
//     instructor: '李教练',
//     location: '训练场地A',
//   },
//   {
//     // key: '3',
//     course: '科目三',
//     date: '2024-05-17',
//     time: '10:00 - 12:00',
//     instructor: '王教练',
//     location: '市区路段',
//   },
// ];


const CouresData = () => {
const [courseData,setCourseData]=useState([])
const columns = [
  {
    title: '科目',
    dataIndex: 'subject',
    key: '5',
  },
  {
    title: '日期',
    dataIndex: 'date',
    key: '1',
  },
  {
    title: '场地',
    dataIndex: 'place',
    key: '4',
  }
];
//获取课程表
useEffect(()=>{
  async function getData(){
    const response = await getScheduleAPI('');
    const data=response.data
    if(response !== '')
      setCourseData(data)
  }
  getData()
},[])
  return (
    <Layout>
      <Header style={{  textAlign: 'center' }}>
      <h1 style={{ color: 'white' ,fontSize: '1.5rem'}}>排课数据统计分析</h1>
      </Header>
      <Content style={{ padding: '20px' }}>
        <Row gutter={16}>
          <Col span={8}>
            <Card>
              <Statistic title="总排课数" value={courseData.length} />
            </Card>
          </Col>
          {/* You can add more statistic cards here based on your requirements */}
        </Row>
        <br />
        <Card title="排课数据表格">
          <Table dataSource={courseData} columns={columns} />
        </Card>
      </Content>
    </Layout>
  );
};

export default CouresData;